package models

import (
	"log"

	"github.com/skip2/go-qrcode"
)

type Sut_qrcode struct {
	Header []byte
	Qrcode []byte
}

func (this *Sut_qrcode) GetQrcode(url string) []byte {
	/*
		data:image/png;base64,
	*/
	var (
		retu []byte
		tmp  []byte
	)
	tmp, err := qrcode.Encode(url, qrcode.Medium, 256)
	if err != nil {
		log.Println("URL转换成二维码出错！")
	}
	retu = append(retu, tmp...)
	this.Qrcode = retu
	return retu
}
